<?php
namespace SmartDevice\Model;

use Zend\InputFilter\Factory as InputFactory; // <-- Add this import
use Zend\InputFilter\InputFilter; // <-- Add this import
use Zend\InputFilter\InputFilterAwareInterface; // <-- Add this import
use Zend\InputFilter\InputFilterInterface; // <-- Add this import

class Owner implements InputFilterAwareInterface
{

    public $ownerId;
    public $email;
    public $phoneNo;
    public $authToken;
    public $createdAt;
    public $updatedAt;

    public function exchangeArray($data)
    {
    	$this->ownerId = (isset($data['ownerId'])) ? $data['ownerId'] : null;
    	$this->email = (isset($data['email'])) ? $data['email'] : null;
    	$this->phoneNo = (isset($data['phoneNo'])) ? $data['phoneNo'] : null;
    	$this->authToken = (isset($data['authToken'])) ? $data['authToken'] : null;
    	$this->createdAt = (isset($data['createdAt'])) ? $data['createdAt'] : null;
    	$this->updatedAt = (isset($data['updatedAt'])) ? $data['updatedAt'] : null;
    }
    
    public function getArrayCopy() {
        return get_object_vars($this);
    }
    /*
     * (non-PHPdoc) @see \Zend\InputFilter\InputFilterAwareInterface::setInputFilter()
     */
    public function setInputFilter(\Zend\InputFilter\InputFilterInterface $inputFilter)
    {
        // TODO Auto-generated method stub
        throw new \Exception("Not used");
    }
    
    /*
     * (non-PHPdoc) @see \Zend\InputFilter\InputFilterAwareInterface::getInputFilter()
     */
    public function getInputFilter()
    {
        // TODO Auto-generated method stub
        if (! $this->inputFilter) {
            $inputFilter = new InputFilter();
            $factory = new InputFactory();
            
            $inputFilter->add($factory->createInput(array(
                'name' => 'ownerId',
                'required' => true,
                'filters' => array(
                    array(
                        'name' => 'Int'
                    )
                )
            )));
            
            $inputFilter->add($factory->createInput(array(
                'name' => 'email',
                'required' => true,
                'filters' => array(
                    array(
                        'name' => 'StripTags'
                    ),
                    array(
                        'name' => 'StringTrim'
                    )
                ),
                'validators' => array(
                    array(
                        'name' => 'StringLength',
                        'options' => array(
                            'encoding' => 'UTF-8',
                            'min' => 8,
                            'max' => 128
                        )
                    )
                )
            )));
            
            $inputFilter->add($factory->createInput(array(
                'name' => 'phoneNo',
                'required' => true,
                'filters' => array(
                    array(
                        'name' => 'StripTags'
                    ),
                    array(
                        'name' => 'StringTrim'
                    )
                ),
                'validators' => array(
                    array(
                        'name' => 'StringLength',
                        'options' => array(
                            'encoding' => 'UTF-8',
                            'min' => 11,
                            'max' => 32
                        )
                    )
                )
            )));
            

            $inputFilter->add($factory->createInput(array(
            		'name' => 'authToken',
            		'required' => true,
            		'filters' => array(
            				array(
            						'name' => 'StripTags'
            				),
            				array(
            						'name' => 'StringTrim'
            				)
            		),
            		'validators' => array(
            				array(
            						'name' => 'StringLength',
            						'options' => array(
            								'encoding' => 'UTF-8',
            								'min' => 32,
            								'max' => 32
            						)
            				)
            		)
            )));
            
            $inputFilter->add($factory->createInput(array(
            		'name' => 'createdAt',
            		'required' => true,
            		'filters' => array(
            				array(
            						'name' => 'Int'
            				)
            		)
            )));
            
            $inputFilter->add($factory->createInput(array(
            		'name' => 'updatedAt',
            		'required' => true,
            		'filters' => array(
            				array(
            						'name' => 'Int'
            				)
            		)
            )));
            
            $this->inputFilter = $inputFilter;
        }
        
        return $this->inputFilter;
    }
}

